//
//  MyAlbumCollectionViewCell.m
//  Findif
//
//  Created by Mac on 2018/11/6.
//  Copyright © 2018年 Cicel Chen. All rights reserved.
//

#import "MyAlbumCollectionViewCell.h"
#import "ZJImageMagnification.h"

@interface MyAlbumCollectionViewCell ()

@property (nonatomic, weak)UILabel * showLabel;

@end

@implementation MyAlbumCollectionViewCell

- (void)setStatus:(NSString *)status{
    
    _status = status;
    
    if ([status isEqualToString:@"0"]) {
        
        self.showLabel.hidden = NO;
    }else{
        
        self.showLabel.hidden = YES;
    }
}

-(instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    if (self) {
        //设置控件
        [self setupUI];
    }
    
    return self;
}

- (void)setupUI{

    UIImageView * backImageView = [[UIImageView alloc] initWithFrame:self.bounds];
    
    backImageView.backgroundColor = ZRWhiteColor;
    backImageView.userInteractionEnabled = YES;
//    backImageView.contentMode = UIViewContentModeScaleAspectFit;
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTapGesture)];
    [backImageView addGestureRecognizer:tap];
    
    self.backImageView = backImageView;
    
    [self.contentView addSubview:self.backImageView];
    
    
    UIImageView * gouImageView = [UIImageView new];
    
    gouImageView.image = [UIImage imageNamed:@"勾选"];
    gouImageView.hidden = YES;
    
    self.gouImageView = gouImageView;
    
    [self.backImageView addSubview:self.gouImageView];
    
    
    UILabel * label = [UILabel new];
    
    label.text = @"审核中";
    label.textColor = ColorWithRGB(0xFFE055);
    label.font = [UIFont boldSystemFontOfSize:12 * SCREENH6];
    label.hidden = YES;
    
    self.showLabel = label;
    
    [self.backImageView addSubview:self.showLabel];
}


- (void)layoutSubviews{
    
    [self.gouImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.trailing.mas_equalTo(self.backImageView).offset(-15 * SCREENH6);
        make.bottom.mas_equalTo(self.backImageView).offset(-15 * SCREENH6);
        make.width.height.mas_equalTo(15 * SCREENH6);
    }];
    
    [self.showLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.backImageView);
        make.bottom.mas_equalTo(self.backImageView).offset(-5 * SCREENH6);
    }];
}


- (void)singleTapGesture{

//    if (self.showLabel.hidden) {
    
        [ZJImageMagnification scanBigImageWithImageView:self.backImageView alpha:1];
//    }
    
}

@end


